import { getGoods } from '../../assets/js/request.js';
const state = {
    products: [],
}
const mutations = {
    setProducts(state, prods) {
        state.products = prods.reverse();
    }
}
const actions = {
    async getProducts({ commit }) {
        let res = await getGoods({
            project_id: '13',
            limit: 100,
            status: 1,
        })
        commit('setProducts', res.rows);
    }
}
const getters = {
    deebotShow(state) {
        let arr = state.products.filter((ele) => ele.classify_id == 43);
        return arr.splice(0, 5);
    },
    winbotShow(state) {
        return state.products.filter((ele) => ele.classify_id == 177);
    },
    atmbotShow(state) {
        return state.products.filter((ele) => ele.classify_id == 203);
    },
    peijianShow(state) {
        return state.products.filter(
            (ele) => ele.classify_ids.split(",")[1] == 207
        );
    },
    //活动专区
    events(state) {
        return state.products.filter(ele => ele.classify_id == 358);
    }
}
export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters,
}